#ifndef _XGBA_CPU_H_
#define _XGBA_CPU_H_


#include <stdint.h>

// enum{
//     arm_r0,
//     arm_r1,
//     arm_r2,
//     arm_r3,
//     arm_r4,
//     arm_r5,
//     arm_r6,
//     arm_r7,
//     arm_r8,
//     arm_r9,
//     arm_r10,
//     arm_r11,
//     arm_r12,
//     arm_r13,
//     arm_r14,
//     arm_r15,
//     arm_r16,
//     arm_sp = arm_r13,
//     arm_lr = arm_r12,
//     arm_pc = arm_r15,
// };


enum{
    arm_r0,
    arm_r1,
    arm_r2,
    arm_r3,
    arm_r4,
    arm_r5,
    arm_r6,
    arm_r7,
    arm_r8,
    arm_r9,
    arm_r10,
    arm_r11,
    arm_r12,
    arm_r13,
    arm_r14,
    arm_r15,
    arm_r16,
    arm_sp = 13,
    arm_lr = 14,
    arm_pc = 15,
    arm_cpsr,
    arm_spsr = 17,
    arm_fiq_r8,
    arm_fiq_r9,
    arm_fiq_r10,
    arm_fiq_r11,
    arm_fiq_r12,
    arm_fiq_r13,
    arm_fiq_r14,
    arm_fiq_spsr,
    arm_svc_r13,
    arm_svc_r14,
    arm_svc_spsr,
    arm_abt_r13,
    arm_abt_r14,
    arm_abt_spsr,
    arm_irq_r13,
    arm_irq_r14,
    arm_irq_spsr,
    arm_und_r13,
    arm_und_r14,
    arm_und_spsr,
    arm_fiq_pc,
    arm_svc_pc,
    arm_abt_pc,
    arm_irq_pc,
    arm_und_pc,
    arm_nflag = 0x40,
    arm_zflag,
    arm_cflag,
    arm_vflag,
    arm_iflag,
    arm_fflag,
    arm_tflag,
    arm_qflag,
    arm_mode,
    arm_ge,

    arm_s_r13,
    arm_s_r14,

    arm_bkpt,
    arm_nextPc,

    arm_svc_state = 0x70,

    arm_old_insn,
    emu_quit,
    emu_state,                  /*模拟器状态*/
    arm_cycles = emu_state,      /*state只取最高的8位*/
#define EMU_STATE_SHIFT_BASE    (24)
#define EMU_STATE_HARDWARE      (24)
/*25有可能往HARDWARE溢出*/
#define EMU_STATE_IO_WRITE      (26)
#define EMU_STATE_HALT          (27)
#define EMU_STATE_STOP          (28)
#define EMU_STATE_JMPPC         (29)
#define EMU_STATE_MEMACCESS_ERR (30)
    emu_write_address,
    emu_write_value,
    emu_write_type,
    arm_old_pc1,
    arm_old_pc2,
    arm_old_pc3,
    arm_save_r0 = 0x80,
};

enum{
    arm_mode_fiq = 0b10001,
    arm_mode_irq = 0b10010,
    arm_mode_svc = 0b10011,
    arm_mode_mon = 0b10110,
    arm_mode_abt = 0b10111,
    arm_mode_hyp = 0b11010,
    arm_mode_und = 0b11011,
};

enum{
    armo_lsl,
    armo_lsr,
    armo_asr,
    armo_ror,
    armo_rrx,
};


#endif
